/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.click.app.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 *
 * @author ronald
 */
@Entity
@Table(name = "pant_detail_trade_mark")
public class PantDetailTradeMark  extends BaseObject {

    private static final long serialVersionUID = 1L;
    private PantDetail pantDetail;
    private TradeMark tradeMark;

    private Integer quantity;
    private Long id;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name="id_pant_detail_trade_mark", unique=true, nullable=false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_pant_detail", nullable = false)
    public PantDetail getPantDetail() {
        return pantDetail;
    }

    public void setPantDetail(PantDetail pantDetail) {
        this.pantDetail = pantDetail;
    }
    @Column(name = "quantity", precision = 6, scale = 0)
    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_trademark", nullable = false)
    public TradeMark getTradeMark() {
        return tradeMark;
    }

    public void setTradeMark(TradeMark tradeMark) {
        this.tradeMark = tradeMark;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
                .append(this.id).append(this.quantity)
                .append(this.pantDetail.getId()).append(this.tradeMark.getId()).toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PantDetailTradeMark other = (PantDetailTradeMark) obj;
        if (this.pantDetail != other.pantDetail && (this.pantDetail == null || !this.pantDetail.equals(other.pantDetail))) {
            return false;
        }
        if (this.tradeMark != other.tradeMark && (this.tradeMark == null || !this.tradeMark.equals(other.tradeMark))) {
            return false;
        }
        if (this.quantity != other.quantity && (this.quantity == null || !this.quantity.equals(other.quantity))) {
            return false;
        }
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.pantDetail != null ? this.pantDetail.hashCode() : 0);
        hash = 59 * hash + (this.tradeMark != null ? this.tradeMark.hashCode() : 0);
        hash = 59 * hash + (this.quantity != null ? this.quantity.hashCode() : 0);
        hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    

}
